#include "label.h"

#include <QDebug>
#include <QMouseEvent>

Label::Label(QWidget* parent) : QLabel(parent)
{

}

void Label::mousePressEvent(QMouseEvent *event)
{
    if (event->button() == Qt::LeftButton)
    {
        qDebug() << "左键按下";
    }

    if (event->button() == Qt::RightButton)
    {
        qDebug() << "右键按下";
    }

//    qDebug() << event->x() << ", " << event->y();
//    qDebug() << event->globalX() << ", " << event->globalY();

}

void Label::mouseReleaseEvent(QMouseEvent *event)
{
    if (event->button() == Qt::LeftButton)
    {
        qDebug() << "释放左键";
    }

    if (event->button() == Qt::RightButton)
    {
        qDebug() << "释放右键";
    }

}

void Label::mouseDoubleClickEvent(QMouseEvent *event)
{
    if (event->button() == Qt::LeftButton)
    {
        qDebug() << "双击左键";
    }

    if (event->button() == Qt::RightButton)
    {
        qDebug() << "双击右键";
    }

}
